package com.heima.feign.client;

import com.heima.model.schedule.dtos.Task;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 延迟服务的对外feign接口
 */
@FeignClient("leadnews-schedule")
public interface ScheduleFeignClient {

    /**
     * 添加任务
     * @param task   任务对象
     *
     */
    @PostMapping("/api/v1/task/add")
    public void  addTask(@RequestBody Task task);


    /**
     * 按照类型和优先级来拉取任务
     * @param type
     * @param priority
     */
    @GetMapping("/api/v1/task/pull/{type}/{priority}")
    public Task pull(@PathVariable("type") int type,@PathVariable("priority")  int priority);
}
